http object

This method initiates the retrieval of a URL from the Internet.

string post(string url, string parameters)

Parameters:
url
The URL of the file on the Internet that should be retrieved.
parameters
The parameters that should be passed to the server.

Return value:
A blank string on success, or an error description or blank string on failure (see remarks).

Remarks:
This method will send what is known as a POST request. A POST request is used in those cases where the data you are sending is longer than is feasible with a GET request.

The URL may not contain any special characters such as spaces or similar. If you wish to include such characters, always encode the URL by calling the encode function before attempting to retrieve it from the Internet.

If the http server to which the URL points uses a port other than 80, you will need to include the port after the host name proceeded by a colon. The path on the server (if any) should then follow, proceeded by a slash. Such a URL might look like http://myserver.com:8080/myfile.html.

If multiple requests are made with URL's pointing to the same server, the http object will attempt to keep the connection alive for a short while which results in a dramatic speed increase for subsequent requests.

If the network subsystem fails to initialize, the get_last_error function will return -27 and the returned string will be blank.

If an Internet related error occurs, the get_last_error function will return -29 and the returned string will contain a textual description of the error. This means that you should always call get_last_error after initiating a request.

This method can be used to retrieve both binary and textual data.

The http object is asynchronous, which means that it does not wait for any data before returning. To retrieve data from the server, you must continuously call the request method until the progress boolean property reports false.

Example:
// Post some data to a dummy site.

void main()
{
http download;
string body=download.post("http://www.mysite.com/test.php", "Data=Test&ID=495&Name=Example");
if(get_last_error()!=0)
{
alert("Error", "An error occured.\r\nDescription: " + body + "");
}
else
{
while(download.progress)
{
body+=download.request();
wait(5);
}
clipboard_copy_text(body);
alert("Success", "The data was retrieved and has been copied to your clipboard.");
}
}